-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(resolve): allow overriding enhanced-resolve's options #384
base: master
Are you sure you want to change the base?
feat(resolve): allow overriding enhanced-resolve's options #384
Conversation
Thank you for you PR! I will review it first thing tomorrow morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
|
||
Override the options generated by this plugin for resolving require and import statements. These | ||
options are passed down to `enhanced-resolve`'s factory method and are documented [here on their | ||
GitHub repository](https://github.com/webpack/enhanced-resolve?tab=readme-ov-file#resolver-options). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit concerned that this will over-bind this package to enhanced-resolve
, which may make it harder for us to make changes in the future - e.g. moving to import.meta.resolve
(which I remember it has been discussed somewhere before).
We can state the minimum necessary in the docs. wdty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the minimum necessary really depends on everyone's specific use cases. For us (and why I made this PR) it would be specifying resolverConfig.modules
to add an additional path for modules lookup. For another user it might be any of the 25 options documented in enhanced-resolve
's README.
Or did you mean something else by the minimum neccesary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think resolverConfig.modules
is enough for now. I don't feel that the implementation has to be changed as well - other options can be something like undocumented features. thoughts? /cc @scagood
Allows you to customize the config for module resolution. See: https://github.com/webpack/enhanced-resolve?tab=readme-ov-file#resolver-options
Old description (the PR was initially intended to only specify the
modules
option)Allows you to do things like:
src
folder as amodules
folder andrequire('models/foo');
from within yoursrc
folderBasically this: https://webpack.js.org/configuration/resolve/#resolvemodules
That second bullet point used to be possible by just setting
resolvePaths
but going from this comment on #139 that was considered an unintended side-effect or bug.